Previous Book Contents Next

Inside Macintosh: What's New in ColorSync 2.5 /


Video Card Gamma

ColorSync now supports an optional profile tag for video card gamma. The tag specifies gamma information, stored either as a formula or in table format, to be loaded into the video card when the profile containing the tag is put into use. When you call the function CMSetProfileByAVID and specify a profile that contains a video card gamma tag, ColorSync will extract the tag from the profile and set the video card based on the tag. If you provide monitor calibration software, you should include the video card gamma tag in the profiles you create. See Monitor Calibration and Profiles for more information on ColorSync's support for monitor calibration.

IMPORTANT

The function CMSetSystemProfile does not retrieve video card gamma data to set the video card.

Video Card Gamma Constants

The following sections describe the constants you use to work with the video card gamma profile tag.

Video Card Gamma Tag

When you create a tag to store video card gamma data in a profile, you use the cmVideoCardGammaTag constant to specify the tag.

enum
{
      ...,
      cmVideoCardGammaTag = FOUR_CHAR_CODE('vcgt')
};

Enumerator descriptions

cmVideoCardGammaTag Constant for profile tag that specifies video card gamma information.

Video Card Gamma Tag Type

You use the cmSigVideoCardGammaType constant to specify the signature type for a video card gamma tag. That is, you use this constant to set the typeDescriptor field of the CMVideoCardGammaType structure. There is currently only one type possible for a video card gamma tag.

enum
{
      cmSigVideoCardGammaType = FOUR_CHAR_CODE('vcgt')
};

Enumerator descriptions

cmSigVideoCardGammaType Constant that specifies video card gamma type signature in a video card gamma profile tag.

Video Card Gamma Storage Type

A video card gamma profile tag can store gamma data either as a formula or as a table of values. You use a storage type constant to specify which data storage type the tag uses.

IMPORTANT

If the video card uses a different format than the format you specify, ColorSync will adapt the data you supply to match the format the card expects.
enum {
      cmVideoCardGammaTableType = 0,
      cmVideoCardGammaFormulaType = 1,
};

Enumerator descriptions

cmVideoCardGammaTableType The video card gamma data is stored in a table format. See CMVideoCardGammaTable for a description of the table format.
cmVideoCardGammaFormulaType The video card gamma tag data is stored as a formula. See CMVideoCardGammaFormula for a description of the formula format.

Video Card Gamma Data Types

The following sections describe data types you use to work with the video card gamma profile tag.

CMVideoCardGammaType

The ColorSync Manager defines the CMVideoCardGammaType data structure to specify a video card gamma profile tag.

struct CMVideoCardGammaType
{
      OSType                 typeDescriptor;
      unsigned long          reserved;
      CMVideoCardGamma       gamma;
};
typedef struct CMVideoCardGammaType CMVideoCardGammaType;

Field descriptions

typeDescriptor The signature type for a video card gamma tag. There is currently only one type possible, cmSigVideoCardGammaType.

reserved This field is reserved.

gamma A structure that specifies the video card gamma data for the profile tag, as described in CMVideoCardGamma

CMVideoCardGammaTable

The ColorSync Manager defines the CMVideoCardGammaTable data structure to specify video card gamma data in table format. You specify the number of channels, the number of entries per channel, and the size of each entry. The last field in the structure is an array of size one that serves as the start of the table data. The actual size of the array is equal to the number of channels times the number of entries times the size of each entry.

struct CMVideoCardGammaTable
{
      unsigned short       channels;
      unsigned short       entryCount;
      unsigned short       entrySize;
      char                 data[1];
};
typedef struct CMVideoCardGammaTable CMVideoCardGammaTable;

Field descriptions

channels Number of gamma channels (1 or 3). If channels is set to 1 then the red, green, and blue lookup tables (LUTs) of the video card will be loaded with the same data. If channels is set to 3, then if the video card supports separate red, green, and blue LUTs, then the video card LUTs will be loaded with the data for the three channels from the data array.

entryCount Number of entries per channel (1-based). The number of entries must be greater than or equal to 2.

entrySize Size in bytes of each entry.

data Variable-sized array of data. The size of the data is equal to channels

CMVideoCardGammaFormula

The ColorSync Manager defines the CMVideoCardGammaFormula data structure to specify video card gamma data by providing three values each for red, blue and green gamma. The values represent the actual gamma, the minimum gamma, and the maximum gamma for each color. Specifying video gamma information by formula takes less space than specifying it with a table, but the results may be less precise.

struct CMVideoCardGammaFormula
 {
      Fixed         redGamma;
      Fixed         redMin;
      Fixed         redMax;
      Fixed         greenGamma;
      Fixed         greenMin;
      Fixed         greenMax;
      Fixed         blueGamma;
      Fixed         blueMin;
      Fixed         blueMax;
};

Field descriptions

redGamma The gamma value for red. It must be greater than 0.0.

redMin The minimum gamma value for red. It must be greater than 0.0 and less than 1.0.

redMax The maximum gamma value for red. It must be greater than 0.0 and less than 1.0.

greenGamma The gamma value for green. It must be greater than 0.0.

greenMin The minimum gamma value for green. It must be greater than 0.0 and less than 1.0.

greenMax The maximum gamma value for green. It must be greater than 0.0 and less than 1.0.

blueGamma The gamma value for blue. It must be greater than 0.0.

blueMin The minimum gamma value for blue. It must be greater than 0.0 and less than 1.0.

blueMax The maximum gamma value for blue. It must be greater than 0.0 and less than 1.0.

CMVideoCardGamma

The ColorSync Manager defines the CMVideoCardGamma data structure to specify the video gamma data to store with a video gamma profile tag. The structure is a union that can store data in either table or formula format.

 struct CMVideoCardGamma
{
      unsigned long                tagType;
      union
      {
      CMVideoCardGammaTable        table;
      CMVideoCardGammaFormula      formula;
      }                            u;
};
typedef struct CMVideoCardGamma CMVideoCardGamma;

Field descriptions

tagType A Video Card Gamma Storage Type constant that specifies the format of the data currently stored in the union. To determine the type of structure present in a specific instance of the CMVideoCardGamma structure, you test this union tag. When storing video card gamma data, you set tagType to a constant value that identifies the structure type.

table A structure of type CMVideoCardGammaTable. If the tagType field has the value cmVideoCardGammaTableType, the CMVideoCardGamma structure's union field should be treated as a table, as described in CMVideoCardGammaTable.

formula A structure of type CMVideoCardGammaFormula. If the tagType field has the value cmVideoCardGammaFormulaType, the CMVideoCardGamma structure's union field represents a formula, as described in CMVideoCardGammaFormula.

Previous Book Contents Next